import itertools


def iteratable_chain_operate(data):

    # 1.过滤出正数
    filter_iterator = filter(lambda x: x > 0, data)

    # 排好序

    sorted_nums_iterator = sorted(filter_iterator)

    # 2.对过滤出的正整数每个数都平方

    map_iteratore = map(lambda x: x**2, sorted_nums_iterator)

    # 3取出前5个出来

    before_five_item = itertools.islice(map_iteratore, 5)

    return list(before_five_item)


test_nums = [4, -1, 3, 5, -2, -100, -90, 6, 1, 2]

list_num = iteratable_chain_operate(test_nums)
print(list_num)

new_list_map_iterator = map(lambda x: x**2, sorted(filter(lambda x: x > 0, test_nums)))
for item in new_list_map_iterator:
    print("item====", item)
